package com.huawei.crm.domain;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;

import java.util.HashMap;

@EqualsAndHashCode(callSuper = true)
@Data
@TableName("department")
public class Department extends BaseEntity {

    @TableId(type = IdType.AUTO)
    private Long id;

    private String name;

    private String sn;

    // 将需要的数据转换后才能JSON字符串返回
    public String getJson() {
        HashMap<String, Object> map = new HashMap<>();
        map.put("id", id);
        map.put("name", name);
        map.put("sn", sn);
        // 将map集合转换成Json字符串返回
        return JSON.toJSONString(map);
    }
}
